package com.qqt.csr.common.utils;

public class CacheKeyUtil {
    public static final String SYS_MODEL = "QQT:CSR:";

    public static long EXPIRE_TIME_1S = 1000L;
    public static long EXPIRE_TIME_5S = 5L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_10S = 10L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_15S = 15L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_30S = 30L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_60S = 60L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_1M = 60L * EXPIRE_TIME_1S;
    public static long EXPIRE_TIME_1H = 60L * EXPIRE_TIME_1M;
    public static long EXPIRE_TIME_2H = 2L * EXPIRE_TIME_1H;
    public static long EXPIRE_TIME_8H = 8L * EXPIRE_TIME_1H;
    public static long EXPIRE_TIME_1D = EXPIRE_TIME_1H * 24L;
    public static long EXPIRE_TIME_3D = EXPIRE_TIME_1D * 3L;

    public static class SkillSet{
        public static final String MODEL = SYS_MODEL + "skill:set:";

        /**
         * 技能组列表
         */
        public static final String SKILL_SET_LIST = MODEL + "LIST:%s";
        /**
         * 缓存技能组列表锁
         */
        public static final String SKILL_SET_LIST_LOCK = MODEL + "LIST_LOCK:%s";
        /**
         * 执行访客/客服超时监控任务锁
         */
        public static final String CHAT_MONITOR_LOCK = MODEL + "CHAT_MONITOR_LOCK";
        /**
         * 技能组配置，SSC:技能组id
         */
        public static final String SKILL_SET_CONFIG = MODEL + "SSC:%s";
        /**
         * 路由结果分布式锁
         */
        public static final String ROUTE_TASK_RESULT_LOCK = MODEL + "ROUTE_TASK_RESULT_LOCK:%s";
    }

    public static class IM {
        public static final String MODEL = SYS_MODEL + "im:";

        /**
         * 连接
         */
        public static final String CONNECT = MODEL + "connect:%s_%s_%s";

        /**
         * 会话创建分布式锁
         */
        public static final String CREATE_CONVERSATION_LOCK = MODEL + "CML:%s";

        /**
         * 加入会话分布式锁
         */
        public static final String JOIN_CONVERSATION_LOCK = MODEL + "JCL:%s";
        /**
         * 账号创建分布式锁
         */
        public static final String CREATE_ACCOUNT_LOCK = MODEL + "CAL:%s";

        /**
         * 连接更新分布式锁
         */
        public static final String UPDATE_CONNECTION_LOCK = MODEL + "UNNL:%s";

        /**
         * 消息保存分布式锁
         */
        public static final String SAVE_MSG_LOCK = MODEL + "SMSGL:%s";

        /**
         * 房间成员缓存key
         */
        public static final String ROOM_MEM_LIST_KEY = MODEL + "room:memlist:%s";

        /**
         * 账号连接缓存key
         */
        public static final String ACCOUNT_CNN_LIST_KEY = MODEL + "account:cnn:%s";

        /**
         * 账号缓存key
         */
        public static final String ACCOUNT_INFO_BY_ID_KEY = MODEL + "account_info_id:%s";

        /**
         * 账号缓存key
         */
        public static final String ACCOUNT_INFO_BY_ACCOUNT_USER_ID_KEY = MODEL + "account_info_user_id:%s";
        /**
         * 敏感词显示规则缓存key:tenantId
         */
        public static final String SENSITIVE_WORD_RULE_KEY = MODEL + "sw_rule_key:%s";
        /**
         * 敏感词库缓存key:repoId
         */
        public static final String SENSITIVE_WORD_REPO_KEY = MODEL + "sw_repo_key:%s";
        /**
         * 定时刷新本地敏感词工具分布式锁
         */
        public static final String SENSITIVE_WORD_REFRESH_LOCK = MODEL + "sw_refresh_Lock";
        /**
         * 导入敏感词分布式锁
         */
        public static final String IMPORT_SW_MQ_LOCK = MODEL + "IMPORT_SW_MQ_LOCK:%s";
        /**
         * 导入敏感词分布式锁
         */
        public static final String IMPORT_SW_REPO_LOCK = MODEL + "IMPORT_SW_REPO_LOCK:%s";
    }

    public static class System {
        public static final String MODEL = SYS_MODEL + "system:";
        /**
         * 雪花算法的数据中心分配机器id key
         */
        public static final String SNOWFLAKE_DATA_CENTER_DISTRIBUTE = MODEL + "snowflake:dc:distribute:%s";
        /**
         * 雪花算法的机器id key
         */
        public static final String SNOWFLAKE_MACHINE_ID = MODEL + "snowflake:mid";
        /**
         * 服务时间配置 key
         */
        public static final String SERVICE_TIME = MODEL + "SERVICE_TIME:%s";
    }

    public static class File {
        public static final String MODEL = SYS_MODEL + "file:";
        /**
         * 定时取消已失效分段上传任务锁
         */
        public static final String ABORT_EXPIRE_MULTI_TASK_LOCK = MODEL + "AEMTLock";
    }

    public static class CsMemberInfo {
        public static final String MODEL = SYS_MODEL + "cs:";
        /**
         * 客服账号正常状态时的信息
         */
        public static final String CS_NORMAL_INFO = MODEL + "CS_NORMAL_INFO:%s";
    }

    public static class ChannelInfo {
        public static final String MODEL = SYS_MODEL + "Channel:";
        /**
         * 渠道信息
         */
        public static final String CHANNEL_INFO = MODEL + "Channel_INFO:%s";
    }

    public static class Archive {
        public static final String MODEL = SYS_MODEL + "archive:";

        /**
         * 会话存档
         */
        public static final String CONVERSATION_ARCHIVE = MODEL + "conversation:archive:%s";
    }

    public static class AiCustomer {
        public static final String MODEL = SYS_MODEL + "aiCustomer:";
        /**
         * 应用访问token
         */
        public static final String ACCESS_TOKEN = MODEL + "ACCESS_TOKEN";
    }

    public static class Order {
        public static final String MODEL = SYS_MODEL + "ORDER:";

        public static final String ORDER_NO_INCREMENT = MODEL + "ORDERNO:INCREMENT:%s";
        public static final String ORDER_NO_INCREMENT_LOCK_KEY = MODEL + "ORDERNO:INCREMENT:LOCK:%s";
        public static final String ORDER_EVENT_HANDLE_LOCK_KEY = MODEL + "ORDER:EVENT:HANDLE:LOCK:%s";
        /**
         * 执行处理中的工单已耗时统计任务锁
         */
        public static final String CALCULATE_ELAPSED_TIME_LOCK = MODEL + "CALCULATE_ET_LOCK";
    }

    public static class CsrRoute {
        public static final String MODEL = SYS_MODEL + "CsrRoute:";

        /**
         * 技能组下所有就绪工作正常状态的成员id
         */
        public static final String CS_READY_STATUS_LIST = MODEL + "CS_READY_STATUS_LIST:%s";
        /**
         * 转人工客服，客服正在接待进线数
         */
        public static final String CS_CHAT_VISITOR_COUNT = MODEL + "CS_CHAT_VISITOR_COUNT:%s";

        /**
         * 路由分发任务创建分布式锁
         */
        public static final String CREATE_ROUTE_TASK_LOCK = MODEL + "CRT:%s";
        /**
         * 访客今日转人工客服次数
         */
        public static final String VISITOR_ACCESS_CS_COUNT = MODEL + "VISITOR_ACCESS_CS_COUNT:%s";
        /**
         * 客服今日接待访客次数
         */
        public static final String CS_ACCESS_VISITOR_COUNT = MODEL + "CS_ACCESS_VISITOR_COUNT:%s";
        /**
         * 技能组轮询分配策略，最近分配索引缓存key
         */
        public static final String DISTRIBUTION_SKILL_SET_POLL_INDEX = MODEL + "DSSP_LAST_INDEX:%s";
         /**
         * 统计每个技能组的总会话时间长
         */
        public static final String DISTRIBUTION_SKILL_SET_STAT_CONVERSATION_TIME = MODEL + "DSSSC_TIME:%s";
        /**
         * 统计每个技能组的总会话数量
         */
        public static final String DISTRIBUTION_SKILL_SET_STAT_CONVERSATION_COUNT = MODEL + "DSSSC_COUNT:%s";
        /**
         * 技能组的排队队列
         */
        public static final String DISTRIBUTION_SKILL_SET_QUEUE = MODEL + "DSS_QUEUE:%s";
        /**
         * 技能组的队列列表
         */
        public static final String DISTRIBUTION_SKILL_SET_QUEUE_LIST = MODEL + "DSS_QUEUE_LIST";
        /**
         * 访客排队队列出队分布式锁
         */
        public static final String VISITOR_QUEUE_POLL_LOCK = MODEL + "VISITOR_QUEUE_POLL_LOCK:%s";
        /**
         * 路由规则信息
         */
        public static final String ROUTE_INFO = MODEL + "ROUTE_INFO:%s";
        /**
         * IM消息处理分布式锁
         */
        public static final String IM_MSG_HANDLER_LOCK = MODEL + "IM_MSG_HANDLER_LOCK:%s";
        /**
         * 路由任务监听分布式锁
         */
        public static final String DISTRIBUTION_ROUTE_TASK_HANDLER_LOCK = MODEL + "DISTRIBUTION_RTH_LOCK:%s";

    }

    public static class Ixport {
        public static final String MODEL = SYS_MODEL + "IXPORT:";
        /**
         * 处理任务分布式锁
         */
        public static final String PROCESS_TASK_LOCK = MODEL + "PROCESS_TASK_LOCK:%s";
        /**
         * 导入任务信息
         */
        public static final String IMPORT_TASK_INFO = MODEL + "IMPORT_TASK_INFO:%s";
    }
}
